package com.bw.controller.orders;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bw.entity.orders.PiOrderLog;
import com.bw.req.OrderLog;
import com.bw.resp.ResponseResult;
import com.bw.service.orders.IPiOrderLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lizhengqian
 * @since 2020-06-19
 */
@RestController
@RequestMapping("orderLog")
public class PiOrderLogController {

    @Autowired
    private IPiOrderLogService orderLogService;

    private final Logger logger = LoggerFactory.getLogger(PiOrderLogController.class);

    /**
     * @Description:订单记录
     * @Author: 周明丽
     * @Date: 2020/6/21 10:51
     * @param id:
     * @return: com.bw.resp.ResponseResult
     **/
    @GetMapping("list/{id}")
    public ResponseResult list(@PathVariable("id") Long id) {
        logger.info("查询订单记录开始");
        ResponseResult result = ResponseResult.SUCCESS();

        try {

            List<OrderLog> orderLogs = orderLogService.listLog(id);
            result.setResult(orderLogs);

        }catch (Exception e){
            logger.error("查询订单记录失败"+e.toString());
            result.setSuccess(false);
            result.setMessage("查询订单记录失败:" + e.toString());
        }
        logger.info("查询订单记录结束");
        return result;
    }

}
